Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill the incremental generator ForAttributeWithMetadataName from roslyn (for JsonGenerator). #71653

Merged
merged 5 commits into from
Jul 6, 2022

Conversation

CyrusNajmabadi
Copy link
Member

Followup to #70911

@ghost
Copy link

ghost commented Jul 5, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Followup to #70911

Author: CyrusNajmabadi
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@@ -550,38 +551,6 @@ private static bool TryGetClassDeclarationList(INamedTypeSymbol typeSymbol, [Not
return typeGenerationSpec;
}

internal static bool IsSyntaxTargetForGeneration(SyntaxNode node) => node is ClassDeclarationSyntax { AttributeLists.Count: > 0, BaseList.Types.Count: > 0 };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved into the 3.11 source as that's the only place this is used now.


if (fullName == JsonSerializableAttributeFullName)
{
return classDeclarationSyntax;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Teh only check we did was that hte fully qualified name is what we want. that's exactly what roslyn now does, so we need no additional semantic checks once we move to the roslyn api.

_pos--;
return _span[_pos];
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the purpose of this file. If it's a dependency for the added Roslyn helpers, why can't it just live inside $CommonPath?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It def can, and i've made that change in #71652. I'll port that over to this one.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review July 5, 2022 17:54
@joperezr
Copy link
Member

joperezr commented Jul 5, 2022

cc @eiriktsarpalis @layomia @krwq @ericstj PTAL. For context, @CyrusNajmabadi is helping us add a much more performant way for source generators that depend on Attributes to run, and with these PRs he is onboarding generators one-by-one. Since you are the owners of the Json Source generator, do you mind taking a look at the changes and make sure they makes sense?

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a couple of comments.

@eiriktsarpalis
Copy link
Member

Related to #68353.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants